package writtenexamination.yuewen;

/**
 * @author cyt
 * @create 2020-10-21 下午 7:36
 */
public class Ta {

    public static void main(String[] args) {
        Ta ta = new Ta();
        System.out.println(ta.countBit(15));
    }

    public int countBit(int n) {
        // write code here
        int ans = 0;
        int temp = n;
        while (temp > 0) {
            if (temp % 2 == 1) {
                ans++;
            }
            temp = temp / 2;
        }
        return ans;
    }
}
